package com.woniu.humanresource.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.humanresource.dto.CheckinCountDto;
import com.woniu.humanresource.entity.CheckInCount;
import com.woniu.humanresource.dao.CheckInCountMapper;
import com.woniu.humanresource.service.CheckInCountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyq
 * @since 2022-07-12
 */
@Service
public class CheckInCountServiceImpl extends ServiceImpl<CheckInCountMapper, CheckinCountDto> implements CheckInCountService {

    @Autowired
    private CheckInCountMapper checkInCountMapper;
    @Override
    public Page getALl(Integer pageIndex,Integer pageSize,String name,String depName,Integer nums) {
        Page allCheckInCountDto = checkInCountMapper.getAllCheckInCountDto(new Page(pageIndex, pageSize), new QueryWrapper<CheckinCountDto>()
                .eq(!StringUtils.isBlank(depName), "d.pname", depName)
                .eq(nums != null, "e.id", nums)
                .like(!StringUtils.isBlank(name), "e.name", name)


        );
        return allCheckInCountDto;
    }
}
